FIND_PATH(ZOPFLI_INCLUDE_DIR
		NAMES
		zopfli.h
		PATH_SUFFIXES
		zopfli
)

FIND_LIBRARY(ZOPFLI_LIBRARY
		NAMES
		zopfli
)

SET(ZOPFLI_INCLUDE_DIRS ${ZOPFLI_INCLUDE_DIR})
SET(ZOPFLI_LIBRARIES ${ZOPFLI_LIBRARY})

IF(NOT ZOPFLI_INCLUDE_DIRS)
  MESSAGE(FATAL_ERROR "Zopfli include dirs cannot be found")
ENDIF(NOT ZOPFLI_INCLUDE_DIRS)

IF(NOT ZOPFLI_LIBRARIES)
  MESSAGE(FATAL_ERROR "Zopfli library cannot be found")
ENDIF(NOT ZOPFLI_LIBRARIES)

#Functions
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_INCLUDES ${ZOPFLI_INCLUDE_DIRS})
SET(CMAKE_REQUIRED_LIBRARIES ${ZOPFLI_LIBRARIES})


#Is zopfli found ?
IF(ZOPFLI_INCLUDE_DIRS AND ZOPFLI_LIBRARIES)
  SET(ZOPFLI_FOUND "YES" )
ENDIF(ZOPFLI_INCLUDE_DIRS AND ZOPFLI_LIBRARIES)


MARK_AS_ADVANCED(
  ZOPFLI_LIBRARIES
  ZOPFLI_INCLUDE_DIRS
)
